#ifndef FFVEncoderThread_H
#define FFVEncoderThread_H

#include"ffthread.h"

extern "C"{
#include<libavformat/avformat.h>
}

class FFVEncoderPars;
class FFVEncoder;
class FFVFrameQueue;
class FFVideoPars;
class FFMuxer;
class FFVDecoder;


class FFVEncoderThread : public FFThread
{
public:
    FFVEncoderThread();
    virtual ~FFVEncoderThread()override;
    void init(FFVEncoder* vEncoder_,FFMuxer*muxer_,FFVDecoder*vDecoder_,FFVFrameQueue* frmQueue_);

protected:
    virtual void run() override;
private:
    void initEncoder(AVFrame*frame);

private:
    FFVideoPars* vPars = nullptr;
    FFVEncoder* vEncoder = nullptr;
    FFVFrameQueue* frmQueue = nullptr;
    FFMuxer* muxer = nullptr;
    FFVDecoder* vDecoder = nullptr;

    int streamIndex = -1;
    AVRational cameraTimeBase;
};

#endif // FFVEncoderThread_H
